<template>
  <div class="page-list__item">
    <div class="item-content" @click.stop="onHandleDetail">
      <div class="item-content-line">
        <span>撮合时间：{{matchItem.matchDate}}</span>
        <span :class="matchItem.matchStatus == '1' ?  'f1' : matchItem.matchStatus == '2' ? 'f2':''">待反馈</span>
      </div>
      <div class="item-content-top">
        <span :class="matchItem.bType == '产品'?'isProduct':''">{{matchItem.bType}}</span>
        <div class="item-content-top-title">{{matchItem.bLable}}</div>
      </div>
       <div class="item-content-middle">
          <span>发布方：{{matchItem.pubParty}}</span>
          <div :class="matchItem.bMan == '供给方'?'isOffering':''">{{matchItem.bMan == '供给方'?'供给方':'需求方'}}</div>
      </div>
      <div class="item-content-bottom" >
        <span>合作方：{{matchItem.cooperParty}}</span>
      </div>
      <div class="item-react">
        <button  v-if="matchItem.matchRes == '1'" @click.stop.self="toResults">查看撮合结果</button>
        <button v-else class="bg1" @click.stop.self="toResults">反馈撮合结果</button>
      </div>
  </div>
  </div>
    <van-overlay :show="show" @click="onMatchResult" z-index="100">
      <div class="wrapper" @click.stop>
        <div class="block">
          <div class="lable">反馈撮合结果</div>
          <van-radio-group v-model="checked" direction="horizontal">
            <van-radio name="1">已达成</van-radio>
            <van-radio name="2">未达成</van-radio>
          </van-radio-group>
          <textarea ref="textRef" name="" id="" placeholder="请简要描述您的交易意向" @change="onFS" v-model="feedfackS"></textarea>
            <div class="rect">
              <button @click="onCancle">取消</button>
              <button @click="onSure">确定</button>
            </div>
        </div>
      </div>
  </van-overlay>
  </template>

<script setup lang="ts">
import { defineProps } from 'vue';
import { useRouter } from "vue-router";
const props = defineProps(['matchItem'])
const feedfackS = ref('')
const show = ref(false)
const checked = ref(1)

const router = useRouter();
const toResults = () => { 
  show.value = true;

}
const onFS = (e:any) => {   
feedfackS.value = e.target.value
}
const onHandleDetail = () => {
  router.push('businessPool/details')
}
const onMatchResult = () => {
   show.value = true;
}
const onCancle = () => {   
  show.value = false;
  console.log(feedfackS.value);
  feedfackS.value = ""
}
const onSure = () => { 
  setTimeout(() => { 
    show.value = false;
    feedfackS.value = ""
  },500)
}

</script>

<style lang="scss" scoped>
 .wrapper {
    position: relative;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    textarea{
      width: 254px;
      height: 116px;
      background: #f7f8fa;
      border-radius: 4px;
      border:none;
      padding:12px;
    }
    :deep(.van-radio-group){
      margin: 16px 0;
    }
  }
  .block {
  width: 302px;
  height: 281px;
  background: #ffffff;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding:24px 24px 23px 24px;
  box-sizing: border-box;
  .lable{
    line-height: 24px;
    font-family: PingFang SC;
    font-weight: 600;
    color: rgba(0, 0, 0, 0.9);
    font-size: 16px;
    text-align: center;
  }
  span{
    margin-top:24px;
    line-height: 24px;
    font-family: PingFang SC;
    color: #86909c;
    font-size: 16px;
    vertical-align: left;
    text-align: left;
  }
   .rect{
     width: 302px;
    margin-top:24px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    font-family: PingFang SC;
    font-weight: 500;
    font-size: 16px;
    text-align: center;
    button:nth-child(1){
     width: 121px;
    height: 42px;
    background: #f2f3f5;
    border-radius: 100px;
    color: #1d2129;
    border-color: transparent;
    }
     button:nth-child(2){
      background-color: red;
      border-color: transparent;
      color:#ffffff;
      width: 121px;
      height: 42px;
      border-radius: 100px;
    }
    }
  }
 
.page-list__item{
  background: #ffffff;
  border-radius: 6px;
  padding:12px 8px 0px 12px;
  display: flex;
  flex-direction: column;
   .item-content{
    width: 100%;
    height: 100%;
     .item-content-top{
      display: flex;
      align-items: center;
      span{
        display: flex;
        justify-content: center;
        align-items:center;
        width: 28px;
        height: 16px;
        background: #0fc6c2;
        border: 1px solid;
        border-color: #0fc6c2;
        border-radius: 3px;
        line-height: normal;
        font-family: Inter;
        font-weight: 500;
        color: #ffffff;
        font-size: 10px;
      }
      .isProduct{
        display: flex;
        justify-content: center;
        align-items:center;
        width: 28px;
        height: 16px;
        border: 1px solid;
        border-radius: 3px;
        line-height: normal;
        font-family: Inter;
        font-weight: 500;
        color: #ffffff;
        font-size: 10px;
        background: #f7c359;
        border-color: #f7c359;
      }
      .item-content-top-title{
        width: 211px;
        height: 24px;
        line-height: normal;
        font-family: PingFang SC;
        font-weight: 500;
        color: #222222;
        font-size: 17px;
        margin-left:4px;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space:nowrap;
      }
      .item-content-top-right{
        color:#ffffff;
        width: 52px;
        height: 22.35px;
        display: flex;
        justify-content: space-around;
        box-sizing: border-box;
        padding:4.67px 6px;
        align-items: center;
        background: linear-gradient(90deg,#ff403b 0%,#ff6d69 100%);
        border-radius: 14px 12px 2px 14px;
        font-size: 14px;
        margin-left: 16px;
      }
    
    }
      .item-content-middle{
        margin-top:8px;
        display: flex;
        div{
          width: 38px;
          height: 16px;
          display: flex;
          justify-content: center;
          align-items: center;
          background: #ffffff;
          border: 1px solid;
          border-color: #f4423e;
          border-radius: 3px;
          line-height: normal;
          font-family: Inter;
          font-weight: 500;
          color: #f4423e;
          font-size: 10px;
          margin-left:13px;
        }
        .isOffering{
         border-color:#4795ff;
         color:#4795ff;
        }
       span{
        line-height: normal;
        font-family: PingFang SC;
        color: #4e5969;
        font-size: 13px;
        margin-left:4px;

       }
      }
      .item-content-bottom{
        margin-top:7px;
        padding:0 4px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        line-height: normal;
        font-family: PingFang SC;
        color: #86909c;
        font-size: 12px;
        span{
          margin-right:10px;
        }
      }
     }
  .item-react{
  height: 56px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  border-top: 0.5px solid;
  border-color: #ebebeb;
  font-family: PingFang SC;
  color: #1d2129;
  font-size: 14px;
  margin-top: 12px;
  button{ 
    width: 116px;
    height: 32px;
    background: #f4423e;
    border-radius: 26px;   
    display: flex;
    justify-content: center;
    align-items: center;
    border:none;
    font-family: PingFang SC;
    font-weight: 500;
    color: #ffffff;
    font-size: 14px;
  }
  .bg1{
  background: #ffffff;
  border: 1px solid;
  border-color: #f4423e;
  border-radius: 16px;
  line-height: 22px;
  font-family: PingFang SC;
  font-weight: 600;
  color: #f4423e;
  font-size: 14px;
  text-align: center;
  }
  }
}
.item-content-line{
  display: flex;
  justify-content: space-between;
  align-items: center;
  .f1{
    color:#2ba471;
  }
  .f2{
  color:#e37318;
  }
  span:nth-child(1){
    line-height: normal;
    font-family: Inter;
    color: #86909c;
    font-size: 12px;
  }
  span:nth-child(2){
    line-height: normal;
    font-family: Inter;
    font-weight: 500;
    color: #d54941;
    font-size: 14px;
  }
}

</style>

